/**
 * @author zowie
 * @param {array} array
 * @return {array} array
 */
function removeZeros(array) {
  let flag = 0, len = array.length
  for (i = len - 1; i >= 0; i--) { //寻找诡异多端的0，如果找到了还要判断有没有需要移动的
    if (array[i] == 0 || array[i] == '0') {
      if (i + flag < len - 1) {
        let temp = array[i] //把0先拎出来，空出位置
        for (j = i + 1; j < len - flag; j++) { //把非零元素向前移动一位
          array[j - 1] = array[j]
          console.log(array)
        }
        array[len - flag - 1] = temp
        flag++
      }
    }
  }
  return array;
}

console.log(removeZeros([7, 2, 3, " 0", 4, 6, 0, '0', 13, 0, 78, 0, 0, 19, 14]));

//若可以另辟空间
function removeZeros(array) {
  const head = []
  const tail = []
  for (const e of array) {
    if (e === 0 || e === "0") {
      tail[tail.length] = e
    } else {
      head[head.length] = e
    }
  }
  return [...head, ...tail]
}